package com.djk.daily.thread.uncaughtexception;

/**
 * @Description 使用自定义的UncaughtException
 * @Author dujunkai
 * @Date 2021/7/16 0:07
 **/
public class UseUncaughtExceptionHandler implements Runnable{
    public static void main(String[] args) {
        Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHandler("捕获器"));

        new Thread(new UseUncaughtExceptionHandler(),"MyThread-1").start();
        new Thread(new UseUncaughtExceptionHandler(),"MyThread-2").start();
        new Thread(new UseUncaughtExceptionHandler(),"MyThread-3").start();
        new Thread(new UseUncaughtExceptionHandler(),"MyThread-4").start();
    }

    @Override
    public void run() {
        throw new RuntimeException();
    }
}
